<%@ page import="com.edu.dreams.entity.Anim" %>
<%@ page import="com.github.pagehelper.PageInfo" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>动画管理</title>
  <meta name="description" content="一个充满童话世界的地方，带你回味童年." />
  <meta name="keywords" content="童话、英雄和魔法" />
  <link rel="shortcut icon" href="images/favicon.ico" />
  <!-- 引入我们自己的样式文件 -->
    <link rel="stylesheet" type="text/css" href="css/content.css"/>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script language="javascript">
        function del(nid) {
            if (window.confirm("确认要删除此信息吗?")) {
                window.location.href = "${pageContext.request.contextPath}/deleteanim?id=" + nid;
            }
        }
    </script>
</head>

<body>
<div style="padding-left:4px;">
    <table width="1200" border="0" cellpadding="0" cellspacing="0">
        <tr height="30">
            <td width="270" background="images/title01.jpg" class="title">&gt;&gt;动画管理</td>
            <td width="30"><img src="images/title002.gif"/></td>
            <td width="530" bgcolor="#d9f0ff" class="txt">您的位置：后台管理 &gt;动画管理&gt; 动画信息</td>
        </tr>
    </table>
    <br/>
    <table width="1200" border="0" cellpadding="0" cellspacing="0">
        <tr height="30">
            <td width="270" background="images/title01.jpg" bgcolor="#d9f0ff">
                <div
                        style=" background-color:#d9f0ff; width:130px; height:23px; border-width:1px; border-style:solid; border-color:#CCC; text-align:center; line-height:23px;">
                    <a href="${pageContext.request.contextPath}/addanimpagepage" disabled="disabled"
                       target="main">添加动画</a>
                </div>
            </td>
        </tr>
    </table>

    <h3>动画信息列表</h3>
    <table width="1180" border="1" cellpadding="0" cellspacing="0" style="text-align:center; line-height:30px;">
        <tr>
            <th scope="col">动画名称</th>
            <th scope="col">角色名称1</th>
            <th scope="col">角色名称2</th>
            <th scope="col">角色名称3</th>
            <th scope="col" align="middle">操作</th>
        </tr>
        <%
            for (Anim n : ((PageInfo<Anim>) request.getAttribute("anims")).getList()) {
                out.print("<tr align='middle'>" +
                        "<td>" + n.getAnim_name() + "</td>" +
                        "<td>" + n.getAnim_j1_name() + "</td>" +
                        "<td>" + n.getAnim_j2_name() + "</td>" +
                        "<td>" + n.getAnim_j3_name() + "</td>" +
                        "<td align='middle'><a href='updateAnimationPage?id=" + n.getAnim_id() + "'>编辑</a><input type='button' style='margin-left: 40px;' name='bt1' value='删除' onclick=\"del('" + n.getAnim_id() + "');\"></td>" +
                        "</tr>");
            }
        %>
    </table>
    <table width="1180" border="0" cellpadding="0" cellspacing="0" style="line-height:50px">
        <tbody>
        <tr>
            <td width="40%">&nbsp;</td>
            <td align="right">
                <a href="${pageContext.request.contextPath}/seeanimation?startPage=1">首 页</a>
                <c:choose>
                    <c:when test="${anims.pageNum-1>0}">
                        <a href="${pageContext.request.contextPath}/seeanimation?startPage=${anims.pageNum-1}">上一页</a>
                    </c:when>
                    <c:when test="${anims.pageNum-1<=0}">
                        <a href="${pageContext.request.contextPath}/seeanimation?startPage=1">上一页</a>
                    </c:when>
                </c:choose>
                <c:choose>
                    <c:when test="${anims.pages==0}">
                        <a href="${pageContext.request.contextPath}/seeanimation?startPage=${anims.pageNum}">下一页</a>
                    </c:when>
                    <c:when test="${anims.pageNum+1<anims.pages}">
                        <a href="${pageContext.request.contextPath}/seeanimation?startPage=${anims.pageNum+1}">下一页</a>
                    </c:when>
                    <c:when test="${anims.pageNum+1>=anims.pages}">
                        <a href="${pageContext.request.contextPath}/seeanimation?startPage=${anims.pageNum+1}">下一页</a>
                    </c:when>
                </c:choose>
                <c:choose>
                    <c:when test="${anims.pages==0}">
                        <a href="${pageContext.request.contextPath}/seeanimation?startPage=${anims.pageNum}">未 页</a>
                    </c:when>
                    <c:otherwise>
                        <a href="${pageContext.request.contextPath}/seeanimation?startPage=${anims.pages}">未 页</a>
                    </c:otherwise>
                </c:choose>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>

</html>